﻿using System;
using System.Runtime.InteropServices;

namespace Padsurface.CoreAudio.Components.MMDevice.Interfaces
{
    /// <summary>
    /// Represents an asynchronous operation activating a WASAPI interface and provides a method to retrieve the results of the activation.
    /// </summary>
    [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid(ComIIDs.IActivateAudioInterfaceAsyncOperationIID)]
    public interface IActivateAudioInterfaceAsyncOperation
    {
        /// <summary>
        /// Gets the results of an asynchronous activation of a WASAPI interface initiated by an application calling the ActivateAudioInterfaceAsync function.
        /// </summary>
        /// <param name="activateResult">The result code returned through activateResult may depend on the requested interface</param>
        /// <param name="activateInterface">The returned activatedInterface may be NULL if activateResult is not a success code</param>
        /// <returns>HRESULT: If the method succeeds, it returns S_OK</returns>
        int GetActivateResult([Out] out int activateResult,
                               [Out, MarshalAs(UnmanagedType.IUnknown)] out object activatedInterface);
    }
}